# encoding=utf8

from gifix import gifix

import PIL.Image as Image
import os


# 抽帧测试
image = 'kkk.gif'
name = image.split('.')[0]
gif = gifix(image)
gif.save_gif_sub_frames(name, 'sub_'+name)
gif.save_gif('new2_'+image, 0, 100)



'''
SAME_THRESHOLD = 0.9
COMPRESS_RATE = 8
RESIZE_RATE = 0.4


gif.del_same_frames(SAME_THRESHOLD)
gif.compress_frames(COMPRESS_RATE)
gif.resize_frames(RESIZE_RATE)
gif.save_gif('new2_'+IMAGE_IN, 0, 100)
gif.save_gif_reverse('new22_'+IMAGE_IN, 0, 100)
#gif.save_as_mp4()


# mp4_to_gif('qqqq.mp4')


mp4_to_gif('bbb.mp4')
mp4_cut('zzz.mp4', 3, 10)

clip = mp.VideoFileClip('zzz.mp4')
clip_resized = clip.resize(height=240)
clip_resized.write_videofile("movie_resized.mp4")

# mp4_to_gif('movie_resized.mp4', fps=2.26)

gif = gifix('movie_resized.gif')
gif.save_gif_sub_frames('mmm', 'sub')
gif.save_gif('kkk.gif')
gif.save_gif_reverse('new22_movie_resized.gif')
gif2 = gifix('new22_movie_resized.gif')
'''
